package com.tfw.domain;

/**
 * @program: fruit-sale
 * @description: 重量
 * @author: Fuwen
 * @create: 2022-07-27 18:18
 **/
public enum Weight {
    Jin("Jin",1),
    Kilogram("kg",2)
    ;
private String unit;

private int count;
    Weight(String unit, int count) {
        this.count=count;
        this.unit=unit;
    }

    public static int getCount(String unit){
        for (Weight weight:Weight.values()){
            if (weight.getUnit().equals(unit)){
                return weight.getCount();
            }
        }
        return 1;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }
}
